package com.zero.manage.web.components.entity.rbac;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.zero.manage.web.components.base.BaseDataEntity;
import io.gitee.zerowsh.enums.ToolEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(name = "sys_role")
@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
@ApiModel("系统角色")
public class SysRoleEntity extends BaseDataEntity {
    @Column(name = "state")
    @ApiModelProperty("角色状态")
    @Enumerated(EnumType.STRING)
    private ToolEnums.StateEnums state;

    //    @ManyToMany
//    @JoinTable(name = "sys_role_power", joinColumns = @JoinColumn(name = "role_id"),
//            inverseJoinColumns = @JoinColumn(name = "power_id"))
    @Transient  //标记和数据库没有映射
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Set<SysPowerEntity> powers;
}
